#pragma once

#include "Application.h"
#include "Test.h"

#include "SFML/System.hpp"

#include <vector>

class Test;

class TestManager : public ApplicationEventObserver
{
public:
	typedef phynet::UInt UInt;
	typedef phynet::Real Real;

	TestManager();
	~TestManager();

	// GETTERS
	bool IsTestUpdateEnabled() const;
	float GetSlowMotion() const;

	// SETTERS
	void SetTestUpdateEnabled(bool enabled);
	void SetSlowMotion(const float i_slowMotionTime);
	void SetRenderer(Renderer* renderer);
	void AddTest(Test* i_test);
	void ClearTests();

	// ApplicationEventObserver IMPLEMENTATION
	virtual void		OnKeyUp(sf::Key::Code keyCode);
	virtual void		OnIdle();
	virtual void		OnPaint();

private:
	void StartTest(UInt testNumber);
	void RestartCurrentTest();
	void DrawInstructions();

	std::vector<Test*>	m_tests;
	Test*				m_currentTest;

	Renderer*			m_renderer;

	bool				m_updateEnabled;
	Real				m_slowMotionFactor;
	Real				m_lastUpdateTime;

	sf::Clock			m_clock;
}; // class TestManager
